package com.wanxi.controller.front;

import com.alibaba.fastjson2.JSONObject;
import com.wanxi.dto.ResultDTO;
import com.wanxi.service.ContactService;
import com.wanxi.vo.ContactVO;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * @author Chengbo Zhang
 */
@RestController("contact")
@CrossOrigin(origins = "http://localhost:8081")
@RequestMapping("/contact")
public class ContactController {
    @Autowired
    RabbitTemplate rabbitTemplate;

    @PostMapping("/add")
    public ResultDTO addContact(ContactVO contactVO){
        rabbitTemplate.convertAndSend("wx_centerExchange","contact.add",contactVO);
        return ResultDTO.getDTO(1,contactVO);
    }
}
